package fragmentson;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;

import com.wq.cycling.R;

import java.util.ArrayList;

import bean.EntityForSimple;
import fragmentson.backhandle.BackHandledFragment;
import util.adapter.NoticeAdapter;

/**
 * 公告
 * author：wangqi on 2017/4/26 17:48
 * email：773630555@qq.com
 */
public class FindCarNotice_A extends BackHandledFragment {

	private View rootView;
	private ListView lv_notice;
	private NoticeAdapter adapter;
	private ArrayList<EntityForSimple> mDatas = new ArrayList<>();
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		rootView = getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_findcarnotice_a, null);
		initView();
		return rootView;
	}

	public void initView(){
		rootView.findViewById(R.id.tv_hostorycall).setOnClickListener(listener);

		mDatas.add(new EntityForSimple());
		mDatas.add(new EntityForSimple());
		mDatas.add(new EntityForSimple());
		lv_notice = ((ListView) rootView.findViewById(R.id.lv_notice));
		adapter = new NoticeAdapter(getActivity(),mDatas);
		lv_notice.setAdapter(adapter);
		lv_notice.setOnItemClickListener(new AdapterView.OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				Toast.makeText(getActivity(),"111",Toast.LENGTH_LONG).show();
			}
		});
	}

	public static FindCarNotice_A newInstance() {
		FindCarNotice_A fragment = new FindCarNotice_A();
		return fragment;
	}

	private View.OnClickListener listener = new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			switch (v.getId()){
				case R.id.tv_hostorycall:
					Toast.makeText(getActivity(),"111",Toast.LENGTH_LONG).show();
					break;
				default:
					break;
			}
		}
	};


	@Override
	public boolean onBackPressed() {
		return false;
	}
	
}
